#ifndef _ELEMENTS_PUSHBUTTON_H_
# define _ELEMENTS_PUSHBUTTON_H_

# include "config.h"
# include <string>
# include <SDL/SDL.h>
# include <vector>
# include "ELEMENTS\\AButton.h"
# include "UTILS\\Surface.h"
# include "UTILS\\Rect.h"

NS_BEGIN(SDL)
	NS_BEGIN(ELEMENTS)

	class PushButton : public AButton
	{
	private:
		struct Rects
		{
		public:
			static SDL_Rect UpperLeft;
			static SDL_Rect Upper;
			static SDL_Rect UpperRight;
			static SDL_Rect Right;
			static SDL_Rect BottomRight;
			static SDL_Rect Bottom;
			static SDL_Rect BottomLeft;
			static SDL_Rect Left;
			static SDL_Rect Center;

		private:
			Rects();
			~Rects();

		public:
			static void InitSurfaces(std::vector<UTILS::Surface*> const& _srcs,
									std::vector<UTILS::Surface*> const& _dsts,
									UTILS::Rect const& _size, std::wstring const& _text,
									UTILS::Font const& _font);
		};

	private:
		static UTILS::Surface* IMG_RELEASED;
		static UTILS::Surface* IMG_HOVERED;
		static UTILS::Surface* IMG_PRESSED;
		static UTILS::Surface* IMG_CLICKED;
		static UTILS::Surface* IMG_DISABLED;
		UTILS::Rect m_defaultSize;

	public:
		PushButton(std::wstring const& _text,
				   UTILS::Rect const& _defaultSize = UTILS::Rect(0, 0, 128, 32));
		PushButton(PushButton const& _pushButton);
		~PushButton();

		PushButton& operator=(PushButton const& _pushButton);

		virtual void UpdateState();
		virtual bool Draw(SDL_Surface* _screen);
		virtual void SetPosition(Sint16 _x, Sint16 _y);
		virtual void SetPosition(UTILS::Rect const& _position);
		virtual void Move(Sint16 _offsetX, Sint16 _offsetY);
		virtual void Move(UTILS::Rect const& _offset);

		UTILS::Rect const& GetDefaultSize() const;
		void SetDefaultSize(UTILS::Rect const& _defaultSize);
		virtual void SetText(std::wstring const& _text);

	private:
		void InitImages(UTILS::Rect const& _size);
	};

	NS_END(ELEMENTS)
NS_END(SDL)

#endif // _ELEMENTS_PUSHBUTTON_H_
